Field of the Invention
The present invention generally relates to graphics processing apparatuses and systems, and more particularly to a graphics processing apparatus and a system having the function of selecting graphics elements to be drawn and graphics elements not to be drawn from each other when a figure is drawn on a graphical display device such as a CRT (cathode-ray tube) or an LCD (liquid crystal display) by computer graphics.
When figures generated by computer graphics processing are drawn on a display device, it is not necessarily required to display a graphics element located out of the virtual view space on the display and perform graphics data processing for such a graphics element. Hence, it is possible to reduce the time necessary for figures drawing by selecting only graphics elements to be drawn on the display and performing data processing for the selected graphics elements.
Recently, there has been high activity in computer graphics and there has been a need for a graphics processing apparatus capable of selecting only graphics elements to be drawn at a high speed and thus realizing high-speed drawing. The selected graphics elements form the overall figure or part of the figure.
Conventionally, the selection of the graphics elements to be drawn is implemented by a program describing a sequence of processes executed by a general-purpose processor such as a microprocessor or a DSP (Digital Signal Processor) of the graphics processing apparatus. The process sequence commences recognizing the positions of the end points of graphics elements on a plane or space partitioned into drawn fields and non-drawn fields. Next, it is determined whether each graphics element should be drawn on the basis of the positional relationship between the fields in which the end points are located. Then, only the graphics elements determined to be drawn are actually drawn.
FIG. 1 shows a plane 100 partitioned into a drawn field 101 and non-drawn fields 102-109. The plane 100 is partitioned into nine fields by four straight lines X1, X2, Y1 and Y2. The nine fields are assigned different field codes (0000)-(1010). The drawn field 101 in which a graphics element can be drawn is the field surrounded by the four straight lines X1, X2, Y1 and Y2. Each of the field codes consists of four binary digits. When a point is assigned one of the nine field codes, the point is located in the corresponding field on the plane 100.
When a position on the plane 100 is expressed by coordinates (X, Y), the straight lines X1 and X2 are respectively those which indicate the minimum value Xmin and the maximum value Xmax of the X coordinate of the drawn field 101. Similarly, the straight lines Y1 andY2 are respectively those which indicate the minimum value Ymin and the maximum value Ymax of the Y coordinate of the drawn field 101.
The least significant bit LSB of each field code assigned to the plane 100 is equal to 1) when X greater than Xmax on the coordinates (X, Y), and is equal to 0 when Xxe2x89xa6Xmax. The second bit of each field code from the LSB thereof is equal to 0 when X less than Xmin and is equal to 1 when Xxe2x89xa7Xmin. The third bit of each field code from the LSB thereof is equal to 1 when Y greater than Ymax, and is equal to 0 when Yxe2x89xa6Ymax. The most significant bit MSB of each field code is equal to 0 when Yxe2x89xa6Ymin and is equal to 1 when Y less than Ymin.
At the time of determining whether a graphics element should be drawn, the field codes of the end points of the outer shape of the graphics element on which a decision should be made are determined.
The process for determining the field code of each end point (X, Y) is carried out in accordance with a program as shown in FIG. 2, in which a character string xe2x80x9cCodexe2x80x9d denotes the field code.
The first line of the program shown in FIG. 2 means that the field code is reset to (0000). The second line describes the step of comparing Xmax and X with each other. The third line means that the process is jumped to label 1 described in the fifth line if Xmaxxe2x89xa7X. The fourth line means that the LSB of the field code is set to 1.
The above sequence is repeatedly carried out with regard to the combinations of Xmin and X, Ymax and Y and Ymin and Y. After the field code of each end point is determined, a program process using the field codes is initiated to determine whether the graphics element of interest should be drawn.
It will now be assumed that the graphics element is a line AB, and field codes C0 and C1 are assigned to end point A (coordinates (X0, Y0)) and end point B (coordinates (X1, Y1)). The step of determining whether the line AB should be drawn is carried out in accordance with the program shown in FIG. 3.
The first line of the program shown in FIG. 3 describes an OR operation on the field codes C0 and C1. The second line describes that the process is moved to the step of drawing the line AB if the result of the OR operation indicates zero (C0=C1=0). The third line describes an AND operation on the field codes C0 and C1. The fourth line describes that the line AB is not drawn unless the result of the AND operation indicates zero. The fifth line describes that the process is moved to a clip process if the result of the AND operation is zero.
The clip process is a process in which the positional relationship between the drawn field 101 and the graphics element of interest, and if the graphics element is located in any of the non-drawn fields 102-109, only part of the graphics element located in the drawn field 101 is cut out and is drawn in the drawn field 101.
For example, if both the end points A and B of the line AB are located in the drawn field 101, the field codes C0 and C1 of the end points A and B are both (0000). In this case, the OR operation of the field codes C0 and C1 results in zero. Hence, the line AB is drawn. If the end points A and B are respectively located in the non-drawn fields 102 and 104, the field codes C0 and C1 are respectively (0110) and (0101), and the AND operation thereon results in zero. Hence, the line AB is not drawn. If the end points A and B are respectively located in the drawn fields 101 and 108 and the field code of the end point B is (1000), the AND operation on the field codes results in zero. Hence, the line AB is subjected to the clip process, in which part of the line AB located in the drawn field 101 is selected and is then drawn.
The above-mentioned program can select the graphics elements to be drawn and those not to be drawn from each other and can further select the graphics elements that should be subjected to the clip process.
However, the above-mentioned conventional program has a disadvantage in that the positional relationship between each end point and the boundary lines defining the drawn field 101 are investigated and each of the end points is assigned the respective field code. Hence, the conventional program needs a huge number of steps, and it takes a very long time to complete the process of the program. This prevents speeding up the process of the graphics processing apparatus.
It is a general object of the present invention to provide a graphics processing apparatus and a system in which the above disadvantages are eliminated.
A more specific object of the present invention is to provide a graphics processing apparatus and a system having the function of selecting graphics elements which are, for example, figures or parts thereof to be drawn at a higher speed and being capable of drawing figures at a higher speed.
The above objects of the present invention are achieved by a graphics processing apparatus or system comprising: a drawn field register which stores coordinate values of boundaries of a drawn field; an end point coordinate register which stores coordinate values of end points of a graphical element of interest; a first comparator which compares the coordinate values of the boundaries of the drawn field with the coordinate values of the end points of the graphical element of interest; a comparison result register which stores comparison results output by the first comparator; and a decoder which determines, based on the comparison results, whether the graphical element of interest should be drawn in the drawn field.
The above objects of the present invention are also achieved by a system having the above structural elements and further including a coprocessor implementing the drawn field register, the end point coordinate register, and the first comparator; and a main processor implementing the comparison result register and the decoder.